aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/[lang=lang]/sections/description.svelte
blob: 952a10589f8d0feb02e7a5d7349052bdb1f8b3ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script context="module" lang="ts">
	import type { SanityBlockArray } from "$lib/sanity/types/block-array";

	export type DescriptionModel = {
		title: string;
		content?: SanityBlockArray;
	};
</script>

<script lang="ts">
	import { PortableText } from "@portabletext/svelte";
	export let model: DescriptionModel;

	let visible = true;

	$: if (!model.title) {
		visible = false;
	} else {
		visible = true;
	}
</script>

{#if visible}
	<h2 class="mb-3">{model.title}</h2>
	{#if model.content}
		<PortableText value={model.content} />
	{/if}
{/if}